//package com.example.softwareconfigurationcoursedesign;
//import java.io.File;
//import java.io.FileOutputStream;
//import java.util.List;
//import org.apache.commons.io.FileUtils;
//import org.apache.poi.hssf.usermodel.HSSFCell;
//import org.apache.poi.hssf.usermodel.HSSFRow;
//import org.apache.poi.hssf.usermodel.HSSFSheet;
//import org.apache.poi.hssf.usermodel.HSSFWorkbook;
//
//public class PoiExpExcel {
//    public PoiExpExcel() {
//    }
//
//    public static void poiExp(List<Logs> logsList, String savePath) throws Exception {
//        String[] title = new String[]{"ID","用户名","登录方法","时间", "用户操作"};
//        HSSFWorkbook workbook = new HSSFWorkbook();
//        HSSFSheet sheet = workbook.createSheet();
//        HSSFRow row = sheet.createRow(0);
//        HSSFCell cell = null;
//
//        int i;
//        for(i = 0; i < title.length; ++i) {
//            cell = row.createCell(i);
//            cell.setCellValue(title[i]);
//        }
//
//        for(i = 1; i < logsList.size(); ++i) {
//            Logs log = (Logs)logsList.get(i);
//            HSSFRow nextRow = sheet.createRow(i + 1);
//            HSSFCell cell1 = nextRow.createCell(0);
//            cell1.setCellValue(log.getUserId());
//            HSSFCell cell2 = nextRow.createCell(1);
//            cell2.setCellValue(log.getUserName());
//            HSSFCell cell3 = nextRow.createCell(2);
//            cell3.setCellValue(log.getLoginMethod());
//            HSSFCell cell4 = nextRow.createCell(3);
//            cell4.setCellValue(log.getTimes());
//            HSSFCell cell5 = nextRow.createCell(4);
//            cell5.setCellValue(log.getLogContext());
//        }
//
//        File file = new File(savePath);
//        FileOutputStream stream = FileUtils.openOutputStream(file);
//        workbook.write(stream);
//        stream.close();
//    }
//}
//
